#ifndef _H_C_CUR_THREAD_TIMER_CONTEXT_H_
#define _H_C_CUR_THREAD_TIMER_CONTEXT_H_

#include "../typedefine.h"
#include <memory>

namespace TB
{
	class ITimerContext;

	class CCurThreadTimerContext
	{
	public:
		inline std::shared_ptr<ITimerContext>& GetTimerContext() { return m_poTimerContext; }
		inline const std::shared_ptr<ITimerContext>& GetTimerContext() const { return m_poTimerContext; }
		inline void SetTimerContext(const std::shared_ptr<ITimerContext>& poTimerContext)
		{
			m_poTimerContext = poTimerContext;
		}
		inline static CCurThreadTimerContext& GetCurrent() { return m_oCurThreadTimerContext; }
	private:
		std::shared_ptr<ITimerContext> m_poTimerContext;
		static thread_local CCurThreadTimerContext m_oCurThreadTimerContext;
	};
}

#endif
